function [Woce_sec,stnnbr,stn_num,cast_num,day_stn,h_stn,date_dec,lon_stn,lat_stn,prof,ctdtmp,ctdsal,ctdoxy,minT,maxT,minS,maxS]=WOCE_CTD(campagne,dirWOCE)
% ---------------------------------------------------------
% Programme permettant de tracer les sections WOCE � partir
% des donnees CTD.
%
% Lecture et Trace
%
% (G. Charria)
% --------------------------------------------------------

%close all;

% ---- Ajout du path pour la fonction gcmap !
%P=path;
%path('/home/couleur/charria/bin',P);


% ---- Sch�ma 1: racine+numstn+extension
switch campagne
 case 1
  schema = 1;
  racine='KN51D';
  extension='.WCT';
  cruise='a20';
  minT=0;
  maxT=28;
  minS=30;
  maxS=38;
  
 case 2
  schema = 1;  
  racine='KB51D';
  extension='.WCT';
  cruise='a22';
  minT=0;
  maxT=28;
  minS=33.5;
  maxS=37.5;
  
 case 4
  schema = 1;  
  racine='A25ctd';
  extension='';
  cruise='a25';
  minT=0;
  maxT=20;
  minS=33;
  maxS=36;
  
  
 case 9
  schema = 1;
  racine='KN47D';
  extension='.CTD';
  cruise='ar24_a';
  minT=0;
  maxT=20;
  minS=33;
  maxS=36;  
  
 case 10
  schema = 1;
  racine='KN54D';
  extension='.CTD';
  cruise='ar24_b';  
  minT=5;
  maxT=22;
  minS=33;
  maxS=36.5;
  
 case 6
  schema = 1;
  racine='ETA2';
  extension='A.CTD';
  cruise='ar04_f';
  minT=0;
  maxT=28;
  minS=32.5;
  maxS=36.5;

  
  
  % ---- Sch�ma 2: racine+stn+char+castnbr(3I)+extension
 case 5
  schema = 2;
  racine='M';
  extension='.CTD';
  cruise='a02b';
  racine2='C';  
  minT=0;
  maxT=20;
  minS=32.5;
  maxS=36.5;
  
    
 case 12
  schema = 2;
  racine='G';
  extension='.CTD';
  cruise='ar19_d';
  racine2='C';  
  minT=0;
  maxT=18;
  minS=33.5;
  maxS=36.5;  
  
  % ---- Sch�ma 3: racine+stn+char+castnbr(2I)+extension
 case 3
  schema = 3;
  racine='';
  racine2='';
  extension='.CTD';
  cruise='a24';
  minT=0;
  maxT=20;
  minS=32.5;
  maxS=36;
  
  
  % ---- Sch�ma 4: racine+stn+char+castnbr(1I)+extension
  case 7
   schema = 4;
   racine='B396';
   extension='.CTD';
   cruise='ar12_e';
   racine2='';
   minT=0;
   maxT=20;
   minS=32.5;
   maxS=36;
   
   % ---- Sch�ma 5: racine+stn(I2)+char+castnbr(I1)+extension
 case 8
  schema = 5;
  racine='B97';
  extension='.CTD';
  cruise='ar12_g';
  racine2='C';
  minT=0;
  maxT=20;
  minS=32.5;
  maxS=36;
  
  % ---- Sch�ma 6: racine+stn(3I)+extension
  
 case 11
  schema = 6;
  racine='ar01_a0';
  extension='.wct';
  cruise='ar01_a';
  minT=0;
  maxT=26;
  minS=35;
  maxS=37.5;  
  
 otherwise
  disp('Unknown Cruise !')
end

fichier_su=[dirWOCE,'/isDATA/',cruise,'/',cruise,'su.txt'];
%fichier_track=[dirWOCE,'/isDATA/data/',cruise,'/',cruise,'trk2.jpg'];

[Woce_sec,stnnbr,stn_num,cast_num,day_stn,h_stn,date_dec,lon_stn,lat_stn] = read_CTD_su(fichier_su);

%lat_stn
%save('lon_ar01a.mat','lon_stn')

% ---- Initialisation des variables
prof(1:stnnbr,1:6000)=NaN;
ctdtmp(1:stnnbr,1:6000)=NaN;
ctdsal(1:stnnbr,1:6000)=NaN;
% ---- controle ----
%figure;
% ----
for istn=1:stnnbr
  
  % Test pour les stations test (num stn = 999)
  if (stn_num(istn) < 900) & (stn_num(istn) > 0)
    
    % ----
    
    if (schema == 5)
      
      % Stn: I2
      if (stn_num(istn) < 10)
	numstn=['0',num2str(stn_num(istn))];
      else
	numstn=num2str(stn_num(istn));
      end
      
    else
      
      % Stn: I3
      if (stn_num(istn) < 10)
	numstn=['00',num2str(stn_num(istn))];
      elseif (stn_num(istn) < 100)
	numstn=['0',num2str(stn_num(istn))];
      else
	numstn=num2str(stn_num(istn));
      end
      
    end
    
    % -----  
      
    if (schema == 2)
      
      % Cast: I3
      if (cast_num(istn) < 10)
	numcast=['00',num2str(cast_num(istn))];
      elseif (stn_num(istn) < 100)
	numcast=['0',num2str(cast_num(istn))];
      else
	numcast=num2str(cast_num(istn));
      end
      
    elseif (schema == 3)
      
      % Cast: I2
      if (cast_num(istn) < 10)
	numcast=['0',num2str(cast_num(istn))];
      else
	numcast=[num2str(cast_num(istn))];      
      end
      
    elseif (schema >= 4) & (schema <=5)
      
      % Cast: I1
      if (cast_num(istn) > 10)
	numcast='N';
      else
	numcast=[num2str(cast_num(istn))];
      end
      
    end
      
    % ----
    
    if (schema == 1)    
      fichier_ctd=[dirWOCE,'/isDATA/',cruise,'/',racine,numstn,extension];
    elseif (schema >= 2) & (schema <= 5)
      fichier_ctd=[dirWOCE,'/isDATA/',cruise,'/',racine,numstn,racine2,numcast,extension];
    else
      fichier_ctd=[dirWOCE,'/isDATA/',cruise,'/',racine,numstn,extension];
    end
  
    [prof(istn,:),ctdtmp(istn,:),ctdsal(istn,:),ctdoxy] = read_CTD_WOCE(fichier_ctd); 
    
    % ---- controle ----
    %hold on 
    %plot(ctdtmp(istn,:),ctdsal(istn,:),'+')
    %hold off;
    % ----
  end
  
end





